GridVerify = LibStub("AceAddon-3.0"):NewAddon("GridVerify","AceEvent-3.0","AceConsole-3.0")
local self = GridVerify
local HealComm = LibStub:GetLibrary("LibHealComm-3.0");

function self:OnInitialize()
	self:Print("初始化.键入/gv检查团队成员Grid是否安装.键入/gv g检查公会成员Grid是否安装.")
end

function self:OnEnable()
	self:RegisterChatCommand("gv", "SlashFunc")
end

function self:SlashFunc(arg)
	if (arg == "g") then
		self:PrintNoHealCommGuild()
	else
		self:PrintNoHealCommRaid()
	end
end

function self:PrintNoHealCommRaid()
	SendChatMessage("以下人员未安装Grid或其他团队框架:","RAID",nil,nil);
	local versions = HealComm:GetRaidOrPartyVersions()
	for index = 1 , GetNumRaidMembers() do
		--name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(index)
		if not versions[select(1,GetRaidRosterInfo(index))] then
			local msg = select(1,GetRaidRosterInfo(index))
			SendChatMessage(msg,"RAID",nil,nil);
		end
	end
	SendChatMessage("-----END-----","RAID",nil,nil);
end

function self:PrintNoHealCommGuild()
	self:Print("以下人员未安装Grid或其他团队框架:");
	local versions = HealComm:GetGuildVersions()
	for index = 1 , GetNumGuildMembers() do
		--name, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName = GetGuildRosterInfo(index)
		if not versions[select(1,GetGuildRosterInfo(index))] then
			local msg = select(1,GetGuildRosterInfo(index))
			self:Print(msg);
		end
	end
	self:Print("-----END-----");
end